from appium.webdriver.common.appiumby import AppiumBy

from base.wecom_app import WeComApp
from utils.log_utils import logger


class PersonInformationPage(WeComApp):
    _SETTINGS = AppiumBy.XPATH, "//*[@text='个人信息']/../../../../following-sibling::*[1]"

    def click_settings(self):
        logger.info("定位并点击右上角三个点")
        self.find_and_click(*self._SETTINGS)

        from page.more_settings_page import MoreSettingsPage
        return MoreSettingsPage(self.driver)

    def get_name_text(self, newname):
        logger.info(f"判断{newname}是否存在")
        exists = self.wait_for_text(newname)

        return exists
